<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020-02-25
 * Time: 11:25
 */

namespace Zwwl2016\Cluster;


class Utils
{
    public static function toUnderScore($str)
    {
        $dstr = preg_replace_callback('/([A-Z]+)/',function($matchs)
        {
            return '_'.strtolower($matchs[0]);
        },$str);
        return trim(preg_replace('/_{2,}/','_',$dstr),'_');
    }
}